package hljtaskmanage.android.com.taskmanager;

import android.app.Application;
import android.view.View;
import android.widget.TextView;

import com.peng.library.mantis.Mantis;
import com.peng.library.mantis.expand.list.link.ListConfig;
import com.peng.library.mantis.expand.refresh.link.RefreshConfig;
import com.peng.library.mantis.hint.HintConfig;
import com.peng.library.mantis.hint.OnShowErrorViewListener;

/**
 * Created by admin on 2017/10/18.
 */

public class TaskManagerApplication extends Application {

    private static final String TAG = "TaskManagerApplication";

    public TaskManagerApplication getInstance() {
        return instance;
    }

    private TaskManagerApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        initMantisUi ();
    }

    /**
     * 初始化UI
     */
    private void initMantisUi () {
        // 必须调用初始化
        Mantis.getInstance().init(this);
        // 设置提示的Builder
        Mantis.getInstance().setHintConfigBuilder(getDefaultConfigBuilder());
        // 设置刷新的Builder
        Mantis.getInstance().setListConfigBuilder(getDefaultListBuilder());
        // 设置列表的Builder
        Mantis.getInstance().setRefreshConfigBuilder(getDefaultRefreshBuilder());
    }


    /**
     * 获取默认的提示builder
     * @return
     */
    public HintConfig.Builder getDefaultConfigBuilder() {
        HintConfig.Builder builder = new HintConfig.Builder();
        return builder;
    }

    /**
     * 获取默认的列表builder
     * @return
     */
    public ListConfig.Builder getDefaultListBuilder() {
        ListConfig.Builder builder = new ListConfig.Builder();
        return builder;
    }


    /**
     * 获取默认的刷新builder
     * @return
     */
    public RefreshConfig.Builder getDefaultRefreshBuilder() {
        RefreshConfig.Builder builder = new RefreshConfig.Builder();
        return builder;
    }
}
